﻿using System;
using System.Collections.Generic;
using Inovout.Descriptors;

namespace Inovout.Security
{
    [Serializable]
    public class WindowsUser : IUser, IAuthenticatedUser
    {
        private string name;
        public string Name
        {
            get { return name; }
            set { name = value; }
        }

        private string password;
        public string Password
        {
            get { return password; }
            set { password = value; }
        }

        private WindowsUserType type;
        public WindowsUserType Type
        {
            get { return type; }
        }

        internal WindowsUser(string name, WindowsUserType type)
        {
            ArgumentAssert.IsNotDefault(name, "name");
            this.name = name;
            this.type = type;
        }
        public WindowsUser():
            this(WindowsUserType.AnonymousUser)
        {
        }

        public WindowsUser(string userName)
            : this(userName, WindowsUserType.AuthenticatedUser)
        {
        }

        private WindowsUser(WindowsUserType type)
            :this(type.ToString(),type)
        {
        }
        private static readonly WindowsUser anonymousUser = new WindowsUser(WindowsUserType.AnonymousUser);
        public static WindowsUser AnonymousUser
        {
            get { return anonymousUser; }
        }
    }
}
